<template>
    <view class="x-tabbar-placeholder pb-safe-area">
        <view class="x-tabbar pb-safe-area">
            <view class="x-tabbar-item" v-for="(item,index) in tabbar" :key="index"
            :class="{'x-tabbar-item-active':page&&item.url.includes(page)}"
            @tap="$utils.$page.ads(item)">
                <image :src="page&&item.url.includes(page)?(item.image_2||item.image):item.image" class="x-tabbar-item-icon"/>
                <text class="x-tabbar-item-text">{{item.title}}</text>
            </view>
        </view>
    </view>
</template>
<script>
import {mapState} from 'vuex' 
    export default {
        props: {
            page: {
                type: String,
                default: ''
            }
        },
		computed: {
			...mapState({
				tabbar: state => state.GLOBALSTATUS.tabbar
			}),
		}
    }
</script>
<style lang="scss" scoped>
.x-tabbar-placeholder,
.x-tabbar{
    height: 50px;
    box-sizing: unset;
}
.x-tabbar{
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #FFFFFF;
    display: flex;
    justify-content: space-around;
    align-items: center;
    &-item{
        --text-color: #B1B1B1;
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        &-icon{
            width: 30px;
            height: 30px;
        }
        &-text{
            font-size: 12px;
            color: var(--text-color);
        }
        &-active{
            --text-color: #0AB27D;
        }
    }
}
.py-safe-area,.pb-safe-area {
    padding-bottom: constant(safe-area-inset-bottom) !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
}

.py-safe-area,.pt-safe-area {
    padding-top: constant(safe-area-inset-top) !important;
    padding-top: env(safe-area-inset-top) !important;
}
</style>